const path = require("path");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const { merge } = require("webpack-merge");
const packageConfigs = require("./package.json");
const BuildTipsPlugin = require("./BuildTipsPlugin");

const common = require("./webpack.common");

module.exports = merge(common, {
  mode: "production",
  plugins: [
    new CleanWebpackPlugin(),
    new CopyWebpackPlugin({
      patterns: [
        {
          from: "public",
          globOptions: {
            ignore: ["**/index.html"], // 忽略index的HTML，因为HtmlWebpackPlugin会根据模板输出html
          },
        },
      ],
    }),
    // 输出构建后的文件列表和部署提示
    new BuildTipsPlugin(),
  ],
});
